home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / WIN / MEMCOPY.S < prev    next >
Text File  |  1994-10-11  |  1KB  |  85 lines

  1.     .text
  2.  
  3. //
  4. //    Move data from 16:16 to user program offset
  5. //    void _memcpy_from_far(void *offset32, DWORD far16, WORD bytes);
  6. //
  7.     .align    2, 0x90
  8.     .globl __memcpy_from_far
  9. __memcpy_from_far:
  10.     pushl    %esi
  11.     pushl    %edi
  12.     pushl    %ds
  13.     movl    4*4(%esp), %edi
  14.     movzwl    5*4(%esp), %esi
  15.     movw    5*4+2(%esp), %ax
  16.     movw    %ax, %ds
  17.     movl    6*4(%esp), %ecx
  18.     shrl    $2, %ecx
  19.     rep
  20.     movsl
  21.     movl    6*4(%esp), %ecx
  22.     andl    $3, %ecx
  23.     rep
  24.     movsb
  25.     movl    4*4(%esp), %eax
  26.     popl    %ds
  27.     popl    %edi
  28.     popl    %esi
  29.     ret
  30.  
  31. //
  32. //    Move data from user program offset to 16:16 pointer
  33. //    void _memcpy_to_far(DWORD far16, void *offset32, WORD bytes);
  34. //
  35.     .align    2, 0x90
  36.     .globl __memcpy_to_far
  37. __memcpy_to_far:
  38.     pushl    %esi
  39.     pushl    %edi
  40.     pushl    %es
  41.     movzwl    4*4(%esp), %edi
  42.     movw    4*4+2(%esp), %ax
  43.     movl    5*4(%esp), %esi
  44.     movw    %ax, %es
  45.     movl    6*4(%esp), %ecx
  46.     shrl    $2, %ecx
  47.     rep
  48.     movsl
  49.     movl    6*4(%esp), %ecx
  50.     andl    $3, %ecx
  51.     rep
  52.     movsb
  53.     movl    5*4(%esp), %eax
  54.     popl    %es
  55.     popl    %edi
  56.     popl    %esi
  57.     ret
  58.  
  59.  
  60. //
  61. //    Move string from 16:16 to user program offset
  62. //    void strcpy_fardest(offset32,far16);
  63. //
  64.     .align    2, 0x90
  65.     .globl __strcpy_from_far
  66. __strcpy_from_far:
  67.     pushl    %esi
  68.     pushl    %edi
  69.     pushl    %ds
  70.     movl    4*4(%esp), %edi
  71.     movzwl    5*4(%esp), %esi
  72.     movw    5*4+2(%esp), %ax
  73.     movw    %ax, %ds
  74.     .align    2, 0x90
  75. 1:    lodsb
  76.     stosb
  77.     orb    %al, %al
  78.     jnz    1b
  79.     movl    4*4(%esp), %eax
  80.     popl    %ds
  81.     popl    %edi
  82.     popl    %esi
  83.     ret
  84.  
  85.